package structure;

import java.util.*;

public class Test8 {
    //蓝桥杯 机器翻译(⭐)
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        //在此输入您的代码...
        int a = in.nextInt();
        int b = in.nextInt();
        int num = 0;
        Queue<Integer> queue = new LinkedList<>();
        for(int i = 0;i < b;i++){
            int n = in.nextInt();
            if(!queue.contains(n)){
                num++;
                if(queue.size() >= a){
                    queue.poll();
                }
                queue.offer(n);
            }
        }
        System.out.println(num);
        in.close();
    }
    //蓝桥杯 分布式队列(⭐⭐)
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        //在此输入您的代码...
        int n = in.nextInt();
        int[] arr = new int[n];
        int num;
        while(in.hasNext()){
            String s = in.next();
            switch (s) {
                case "add":
                    num = in.nextInt();
                    arr[0]++;
                    break;
                case "sync":
                    num = in.nextInt();
                    arr[num] = Math.min(arr[num] + 1, arr[0]);
                    break;
                case "query":
                    int len = arr[0];
                    for (int i = 0; i < arr.length; i++) {
                        len = Math.min(len, arr[i]);
                    }
                    System.out.println(len);
                    break;
            }
        }
        in.close();
    }
}
